package com.qd.common.panda.domain.entity.shop.order;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class ProductOrderDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "商城订单";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "订单ID"})
    @NotBlank(message = "订单ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "订单ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String orderId;
    /**
     * 订单金额
     */
    @ExcelProperty(value = {EXCEL_TITLE,"订单金额"})
    private BigDecimal orderAmount;
    /**
     * 订单金额显示
     */
    @ExcelIgnore
    private String orderAmountDisplay;
    /**
     * 实际支付金额
     */
    @ExcelProperty(value = {EXCEL_TITLE,"实际支付金额"})
    private BigDecimal payAmount;
    /**
     * 实际支付金额显示
     */
    @ExcelIgnore
    private String payAmountDisplay;
    /**
     * 优惠金额:这一单优惠了多少钱
     */
    @ExcelProperty(value = {EXCEL_TITLE,"优惠金额"})
    private BigDecimal discountAmount;
    /**
     * 优惠金额显示
     */
    @ExcelIgnore
    private String discountAmountDisplay;
    /**
     * 业务ID:对应订单表中的第三方订单号
     */
    @ExcelIgnore
    @Size(max = 50, message = "业务ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String bid;
    /**
     * 用户ID
     */
    @ExcelIgnore
    @Size(max = 50, message = "用户ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String userId;
    /**
     * 商品编号
     */
    @ExcelIgnore
    @Size(max = 50, message = "商品编号长度不能超过{max}位", groups = DefaultGroup.class)
    private String productCode;
    /**
     * 商品名称
     */
    @ExcelProperty(value = {EXCEL_TITLE,"商品名称"})
    private String productCodeDisplay;
    /**
     * 收货人姓名
     */
    @ExcelProperty(value = {EXCEL_TITLE,"收货人姓名"})
    private String name;
    /**
     * 收货人手机号码
     */
    @ExcelProperty(value = {EXCEL_TITLE,"收货人手机号码"})
    private String phone;
    /**
     * 收货地址
     */
    @ExcelIgnore
    @Size(max = 50, message = "收货地址长度不能超过{max}位", groups = DefaultGroup.class)
    private String addressId;
    /**
     * 收货地址显示
     */
    @ExcelProperty(value = {EXCEL_TITLE,"收货地址"})
    private String addressIdDisplay;
    /**
     * 厂家
     */
    @ExcelIgnore
    @Size(max = 50, message = "厂家长度不能超过{max}位", groups = DefaultGroup.class)
    private String factory;
    /**
     * 支付状态:0未支付1支付成功2支付失败3已支付4取消支付
     */
    @ExcelIgnore
    private Integer payStatus;
    /**
     * 支付状态显示
     */
    @ExcelProperty(value = {EXCEL_TITLE,"支付状态"})
    private String payStatusDisplay;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE,"添加时间"})
    private LocalDateTime addTime;
    @Override
    public void freeData() {
        this.orderId = null;
        this.orderAmount = null;
        this.orderAmountDisplay = null;
        this.payAmount = null;
        this.payAmountDisplay = null;
        this.discountAmount = null;
        this.discountAmountDisplay = null;
        this.payStatus = null;
        this.payStatusDisplay = null;
        this.bid = null;
        this.addTime = null;
        this.userId = null;
        this.productCode = null;
        this.productCodeDisplay = null;
        this.addressId = null;
        this.addressIdDisplay = null;
        this.factory = null;
        this.name = null;
        this.phone = null;
        super.freeData();
    }
}
